import { createSlice, PayloadAction } from '@reduxjs/toolkit'

/* AuthState */
export interface AuthState {
	permissions: string[];
	authRouter: string[];
}

const initialState: AuthState = {
  permissions: [],
	authRouter: []
};


export const globalSlice = createSlice({
  name: 'global',
  initialState,
  reducers: {
    setPermissions: (state, action: PayloadAction<string[]>) => {
      state.permissions = action.payload
    },
    setAuthRouter: (state, action: PayloadAction<string[]>) => {
      state.authRouter = action.payload
    },    
  },
})

export const { setPermissions,setAuthRouter } = globalSlice.actions

export default globalSlice.reducer